package cn.gson.springboot.controller.aftercontroller;

import cn.gson.springboot.model.pjos.Emp;
import cn.gson.springboot.model.pjos.Reply;
import cn.gson.springboot.model.service.afterservice.ReplyService;
import cn.gson.springboot.model.vo.aftervo.ReplyVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("/rep")
public class ReplyController {

    @Autowired
    ReplyService sc;

    @RequestMapping("check-reply")
    @ResponseBody
    public List<Reply> checkReply(Integer culId){
        return sc.selectByCulId(culId);
    }

    @RequestMapping("check-replys")
    @ResponseBody
    public List<Reply> checkReplys(Integer culId){
        return sc.selectByCulIdTwo(culId);
    }

    @RequestMapping("save-reply")
    @ResponseBody
    public void saveReply(Integer empId, String content, Integer culId){
        sc.addReply(empId,content,culId);
    }

    @RequestMapping("delete-reply")
    @ResponseBody
    public void deleteReply(Integer replId){
        sc.deleteReplId(replId);
    }

    @RequestMapping("save-replys")
    @ResponseBody
    public void saveReplys(@RequestBody ReplyVo replvo){
        sc.addReplys(replvo);
    }
}
